package cn.study.luckyapp.user.command;

import cn.study.luckyapp.assembler.UserAssembler;
import cn.study.luckyclient.dto.UserUpdateCmd;
import cn.study.luckyclient.dto.data.UserVo;
import cn.study.luckydomain.User.UserEntity;
import cn.study.luckydomain.gateway.UserGateway;
import io.lettuce.core.dynamic.annotation.Command;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.cms.PasswordRecipientId;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
@Slf4j
public class UserUpdatecmdExe{
    private final UserGateway userGateway;
    public UserVo update(UserUpdateCmd cmd){
        UserEntity userEntity = UserAssembler.toAddEntity(cmd);
        UserEntity userEntity1 = userGateway.updateByUserName(userEntity);
        UserVo userVo = UserAssembler.toUserVo(userEntity1);
        return userVo;
    }
}
